package spring.boot.bean;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class SpringBootBeanApplication {

    @Bean
    public String username() {
        return "xiaoming";
    }

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(SpringBootBeanApplication.class, args);
        String username = context.getBean(String.class);
        System.out.println(username);
    }

}
